import { ASTResult } from '../../types/ops'
import { RelatedSyntacticSugar } from '../../utils/related'

export class GenerateGrammar {
  /**
   * @description 针对 related 语法的转换
   * @extends h2
   */
  private relatedSetup = new RelatedSyntacticSugar()
  protected relatedGrammar(contentItem: ASTResult) {
    return this.relatedSetup.hasRelated(contentItem)
  }
  /**
   * @description related 下的所有分类跳转
   */
  protected relatedLink(contentItem: string) {
    return '- ' + contentItem
  }
  protected relatedTitleAndContent(contentItem: ASTResult): [string, ASTResult] {
    return this.relatedSetup.titleAndContent(contentItem)
  }
  protected relatedCollAdd(map: Map<string, ASTResult[]>, title: string, cont: ASTResult) {
    this.relatedSetup.add(map, title, cont)
  }
}
